//
// Created by vista on 2017/12/9.
//

#ifndef P_P7_H
#define P_P7_H

#include <vector>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

class Solution {
public:
    int reverse(int x) {
        long xx = 0;
        do{
            xx = xx * 10 + x % 10;
            x /= 10;
        }while (x != 0);

        if(xx > (int)0x7fffffff || xx < (int)0x80000000){
            xx = 0;
        }

        return xx;
    }
};

#endif //P_P7_H
